package io.renren.modules.work.service.impl;

import io.renren.vo.ScContractVO;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;

import io.renren.modules.work.dao.ScContractDao;
import io.renren.modules.work.entity.ScContractEntity;
import io.renren.modules.work.service.ScContractService;


@Service("scContractService")
public class ScContractServiceImpl extends ServiceImpl<ScContractDao, ScContractEntity> implements ScContractService {
    @Autowired
    private ScContractDao scContractDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
//        QueryWrapper<ScContractEntity> scContractEntityQueryWrapper = new QueryWrapper<>();
//        if(StringUtils.isNotBlank((String) params.get("companyid"))){
//            scContractEntityQueryWrapper.eq("companyid",params.get("companyid"));
//        }
//        if(StringUtils.isNotBlank((String) params.get("contractname"))){
//            scContractEntityQueryWrapper.like("contractname",params.get("contractname"));
//        }
//        IPage<ScContractEntity> page = this.page(
//                new Query<ScContractEntity>().getPage(params),
//                scContractEntityQueryWrapper
//        );
        IPage<ScContractVO> page = scContractDao.selectScContractVO(new Query<ScContractVO>().getPage(params)
                , (String) params.get("contractname"),(String) params.get("contractid"),(String) params.get("companyid"));

        return new PageUtils(page);
    }



}